<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3>这是购物车</h3>
</body>
<script>

    // 初始获取本地存储的数据
    var userData = sessionStorage.getItem("userState");
    userData = userData ? JSON.parse(userData) : userData;

    // 判断本地的数据状态，是否为未登录，跳转到登录
    if(!(userData && userData.state === 1)){
        alert("你还没有登录，或者登录已失效，请重新登录");
        location.href = "login.html";
    }

</script>
</html>